package com.hanlink.dsp.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.qztech.sdk.R;


/**
 * <pre>
 *
 *  BTDSP
 *
 *
 *  Copyright (C): 2015-11-16
 *
 * Description:
 *
 * Revision History
 * Date			  Author		Description
 * 2015-11-16        PeterVon       初始创建
 *
 * </pre>
 */
public class EffectDialog extends Dialog {
    private static int defaultWidth = 160; // 默认宽度
    private static int defaulHeight = 120;// 默认高度

    private ListView mChoiceListView;

    private IRefreshListener iRefreshListener;

    public EffectDialog(Context context) {
        super(context);
        initView();
    }

    public EffectDialog(Context context, IRefreshListener listener) {
        super(context, R.style.dialog);
        iRefreshListener = listener;
        initView();
    }

    public EffectDialog(Context context, int theme) {
        super(context, theme);
        initView();
    }


    public void setRefreshListener(IRefreshListener listener) {
        iRefreshListener = listener;
    }


    private void initView() {
        setContentView(com.hanlink.res.R.layout.dialog_effect);
        mChoiceListView = (ListView) findViewById(R.id.lvItems);

        String[] mItems = getContext().getResources().getStringArray(R.array.effect_items);
        ArrayAdapter _Adapter = new ArrayAdapter(getContext(), com.hanlink.res.R.layout.list_effect_item, mItems);
        mChoiceListView.setAdapter(_Adapter);
        mChoiceListView.setOnItemClickListener((parent, view, position, id) -> {
            iRefreshListener.refreshActivity(position);
            dismiss();
        });
    }



    public interface IRefreshListener {

        void refreshActivity(int value);
    }

}
